#include <stdio.h>

int urlparse()
{
	char *psz_dup;
    char *psz_parse;
	char *psz_protocol;
    char *p;
    char *p2;

	psz_parse = "http://192.168.2.41/xiaozhi/test.rmvb";

	p  = strstr( psz_parse, ":/" );
	printf("p = %s\n", p);
    if( p != NULL )
    {
        for( p2 = psz_parse; p2 < p; p2++ )
        {

		printf("p2 = %s\n", p2);
		printf("psz_parse = %s\n", psz_parse);
#define I(i,a,b) ( (a) <= (i) && (i) <= (b) )
            if( !I(*p2, 'a', 'z' ) && !I(*p2, 'A', 'Z') && !I(*p2, '0', '9') && *p2 != '+' && *p2 != '-' && *p2 != '.' )
            {
                p = NULL;
                break;
            }

			printf("%d %d %d\n", !I(*p2, 'a', 'z' ) , !I(*p2, 'A', 'Z'), !I(*p2, '0', '9'));
#undef I

        }
    }
	printf("p2 = %s\n", p2);

	if( p != NULL )
    {
        /* we have a protocol */

        /* skip :// */
        *p++ = '\0';
		printf("\t ------ %s %d p = %s\n",  __FUNCTION__, __LINE__, p);
		printf("\t ------ %s %d psz_parse = %s\n",  __FUNCTION__, __LINE__, psz_parse);
        if( p[1] == '/' )
            p += 2;
        psz_protocol = psz_parse;
		printf("\t ------ %s %d url->psz_protocol = %s\n",  __FUNCTION__, __LINE__, psz_protocol);
        psz_parse = p;
		printf("\t ------ %s %d p = %s\n",  __FUNCTION__, __LINE__, p);
		printf("\t ------ %s %d psz_parse = %s\n",  __FUNCTION__, __LINE__, psz_parse);
    }

}

/*

		 ------ vlc_UrlParse 82 url->psz_buffer = http://192.168.2.41/xiaozhi/test.rmvb
         ------ vlc_UrlParse 83 psz_parse = http://192.168.2.41/xiaozhi/test.rmvb
         ------ vlc_UrlParse 86 p = ://192.168.2.41/xiaozhi/test.rmvb
         ------ vlc_UrlParse 91 psz_parse = http://192.168.2.41/xiaozhi/test.rmvb
         ------ vlc_UrlParse 91 psz_parse = http://192.168.2.41/xiaozhi/test.rmvb
         ------ vlc_UrlParse 91 psz_parse = http://192.168.2.41/xiaozhi/test.rmvb
         ------ vlc_UrlParse 91 psz_parse = http://192.168.2.41/xiaozhi/test.rmvb
         ------ vlc_UrlParse 105 p = ://192.168.2.41/xiaozhi/test.rmvb
         ------ vlc_UrlParse 106 psz_parse = http://192.168.2.41/xiaozhi/test.rmvb
         ------ vlc_UrlParse 107 psz_dup = http://192.168.2.41/xiaozhi/test.rmvb
         ------ vlc_UrlParse 110 p = //192.168.2.41/xiaozhi/test.rmvb
         ------ vlc_UrlParse 111 psz_parse = http
         ------ vlc_UrlParse 112 psz_dup = http
         ------ vlc_UrlParse 116 url->psz_protocol = http
         ------ vlc_UrlParse 118 p = 192.168.2.41/xiaozhi/test.rmvb
         ------ vlc_UrlParse 119 psz_parse = 192.168.2.41/xiaozhi/test.rmvb
*/

void tpoint()
{
	char *p;
	char *context = "http://192.168.2.41/xiaozhi/test.vod";

	p = strstr(context, ":/");
	printf("p = %s\n", p);

	*p++ = '\0';
	printf("context = %s \n", context);		// context = http  ?
}



int main()
{
	urlparse();
	return 0;
}
